//
//  PMControl.h
//
//  Copyright (C) 2007 Visual.Wei
//  Author: Wei Shuai <cpuwolf@sina.com>
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
//
#ifndef __H_PMCONTROL__
#define __H_PMCONTROL__

#include <windows.h>

class PMControl
{
	public:
	HWND g_hwnd;
	HWND g_hpwnd;
	int g_ctrlid;
	TCHAR pszWndName[50];
	
	PMControl()
	{
		g_hwnd=NULL;
		g_hpwnd=NULL;
		g_ctrlid=0;
		memset(pszWndName,0,sizeof(pszWndName));
	}
	void Update()
	{
		g_hpwnd=GetParent(g_hwnd);
		g_ctrlid=GetDlgCtrlID(g_hwnd);
	}
	LPTSTR GetCaption()
	{
		if(GetWindowText(g_hwnd,pszWndName,sizeof(pszWndName)))
			return pszWndName;
		else
			return NULL;
	}
	//
	void Destroy()
	{
		::DestroyWindow(g_hwnd);
	}
	virtual DWORD ReSize()=0;

	virtual DWORD Notify(int,LPNMHDR)
	{return FALSE;}
protected:
	virtual DWORD EraseBackground(HDC hdc){return 0;}
	virtual DWORD Paint(HDC hdc){return 1;}
	virtual DWORD Timer(int id,TIMERPROC * proc){return 1;}
	virtual DWORD Command(int code,int id,HWND hwndctl){return 1;}
	virtual DWORD OnDestroy(){return 0;}


};

#endif